var database = require('../../../../data/data.js')
Page({

  data: {
  },

  onLoad: function () {
  },
  onShow: function () {
    var that = this;
      wx.request({
        url: database.url + '/api/V2/softball/softball_list',
        method: "POST",
        header: {
          'content-type': 'application/x-www-form-urlencoded'
        },
        data: {
          accessToken: database.accessToken,
          userId: database.userId
        },
        success(res) {
          console.log(res)
          if (res.data.data.softballList != null) {
            that.setData({
              teams: res.data.data.softballList
            })
          } else {
            that.setData({
              teams: ""
            })
          }
        }
      })
  },
  create_team: function () {
    wx.redirectTo({
      url: '/pages/my/myteam/createteam/createteam',
    })
  },
  main_page: function (e) {
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/pages/team_detail/team_detail?id=' + id+'&type=myteam',
    })
  }
})